package com.atguigu.gulimall.gulimallsearch.controller;

import com.atguigu.gulimall.gulimallsearch.service.searchService;
import com.atguigu.gulimall.gulimallsearch.vo.SearchParam;
import com.atguigu.gulimall.gulimallsearch.vo.SearchResult;
import org.elasticsearch.search.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class searchController {

    @Autowired
    com.atguigu.gulimall.gulimallsearch.service.searchService searchService;


    @GetMapping("/list.html")
    public String getPage(SearchParam searchParam, Model model) throws Exception {
        SearchResult result = searchService.getSearchResult(searchParam);
        model.addAttribute("result",result);


        return "list";
    }


}
